package linwen.wang.aspect;

import linwen.wang.DynamicDataSource;
import linwen.wang.annotation.WR;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

/**
 * @Author zero
 * @Description //TODO
 * @Date 2:42 AM 2024/4/23
 * @Param
 * @return
 **/

@Component
@Aspect
public class DynamicDataSourceAspect implements Ordered {

    // 前置
    // @Before("@annotation(wr)")
    public void before(JoinPoint point, WR wr){
        String name = wr.value();
        DynamicDataSource.name.set(name);
    }

    @Override
    public int getOrder() {
        return 0;
    }

    // 环绕通知
}
